package com.xique.park.controller.app;

import com.xique.common.core.utils.SecurityUtils;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.park.bean.request.h5.noPlate.UnlicensedCarAdmissionRequest;
import com.xique.park.bean.request.h5.noPlate.UnlicensedCarGetPlateRequest;
import com.xique.park.service.biz.service.IParkUnlicensedCarBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author shd
 * @create 2022/6/29 10:18
 */
@RestController()
@RequiredArgsConstructor
@RequestMapping("/unlicensed")
public class AppUnlicensedCarController extends BaseController {

    private final IParkUnlicensedCarBizService unlicensedCarBizService;

    /** 获取无牌车车牌 */
    @GetMapping("/getPlate")
    public AjaxResult getPlate(@Valid UnlicensedCarGetPlateRequest request) {
        request.setType(SecurityUtils.getAppType());
        return unlicensedCarBizService.getPlate(request);
    }

    /** 无牌车车牌入场 */
    @PostMapping("/admission")
    public AjaxResult admission(@Valid @RequestBody UnlicensedCarAdmissionRequest request) {
        request.setType(SecurityUtils.getAppType());
        return unlicensedCarBizService.admission(request);
    }
}
